﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Momdel;

namespace WebApplication1.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        IBaseBLL bll;
        public UserController(IBaseBLL bll)
        {
            this.bll = bll;
        }
        [HttpGet]
        public async Task<dynamic> Loght(string username, string pwd)
        {
            return await bll.Loght(username, pwd);

        }
        [HttpGet]
        public IActionResult Query( int pagecount = 1, int pagesize = 2)
        {
            int totalcount = 0;
            int totalpage = 0;
            var list=bll.Query(out totalcount, out totalpage,pagecount,pagesize);
            return Ok(new
            {
                totalcount = totalcount,
                totalpage = totalpage,
                list = list
            });
        }
    }
}
